<?php
$params = array_merge(
    require(__DIR__ . '/params.php'),
    require(__DIR__ . '/params-local.php'),
    require(__DIR__ . '/error.php')
);

return array_merge(
    [
    'id' => 'app-qulian',
    'defaultRoute'=>'site',
    'basePath' => dirname(__DIR__),
    'controllerNamespace' => 'qulian\controllers',
    'vendorPath' => dirname(dirname(__DIR__)) . '/vendor',
    'bootstrap' => ['log'],
    'language' => 'zh-CN',
    'timeZone' => 'Asia/Shanghai',
    // 'modules' => [],
    'components' => [
        'cache' => [ 
            'class' => 'yii\caching\FileCache', 
            'cachePath' => '@runtime/cache2', 
        ],
        'request' => [
            'csrfParam' => '_csrf-mi',
        ],
        'db' =>require __DIR__.'/db.php', 
        'session' => [
            'name' => 'advancedqulian',
            'timeout'=>3600*2,
        ],
        'redis' => [
            'class' => 'yii\redis\Connection',
            'hostname' => 'localhost',
            'port' => 6379,
            'database' => 0,
            'password' => '123456',
        ],
        'log' => [
            'traceLevel' => YII_DEBUG ? 3 : 0,
            'targets' => [
                [
                    'class' => 'yii\log\FileTarget',
                    'levels' => ['error', 'warning'],
                ],
            ],
        ],
        'errorHandler' => [
            'errorAction' => 'site/error',
        ],
        'urlManager' => [
            'enablePrettyUrl' => true,
            'showScriptName' => false,//隐藏index.php
            'enableStrictParsing' => false,
             //'suffix' => '.html',//后缀，如果设置了此项，那么浏览器地址栏就必须带上.html后缀，否则会报404错误
            'rules' => [
                'info_<id:\d+>' => 'site/info',
                '/search' => 'site/list',
                'list_<id:\d+>_<type:\d+>_<page:\d+>_<keyword:\d+>' => 'site/list',
            ],
        ],
    ],
    'params' => $params,
]);
